/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package servidor;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdom.*;
import org.jdom.input.SAXBuilder;
import org.jdom.output.*;
/**
 *
 * @author Anya
 */
public class validarXml {

    public boolean validar(String ficheroXml)
    {
        boolean valido=false;
        File f=null;
        try{
            f=new File(ficheroXml);

            SAXBuilder builder=new SAXBuilder(true);
            try {
                Document jdoc = builder.build(f);
            } catch (IOException ex) {
                Logger.getLogger(validarXml.class.getName()).log(Level.SEVERE, null, ex);
            }
            valido= true;

        }catch (JDOMException e){
            System.out.println("Documento XML mal formado o incorrecto.");
            System.out.println(e.getMessage());
            valido=false;
        }
        return valido;
    }

}
